There are multiple ways of integrating `makefilet` into your project.

After picking one of the approaches below, you may want to take a look at the [usage instructions](USAGE.md).


# Automatic discovery and download on-demand
This approach is probably the most simple way for many users and projects.

1. add a copy of `makefilet-download-ondemand.mk` to your project:

    ```shell
    wget https://notabug.org/sumpfralle/makefilet/raw/main/makefilet-download-ondemand.mk
    ```

2. `include` it at the top of your project's Makefile:

    ```shell
    sed -i 1i'include makefilet-download-ondemand.mk' Makefile
    ```

This makefilet snippet will discover a system-wide or project-wide available installation of `makefilet`. If it fails, it will download the latest release and extract it in the build directory.

There is no manual intervention involved. You just need to ensure that you have internet connectivity after every `clean` of your project.

From time to time you may want to update the above makefilet snippet within your project.


# Embed as a git submodule
Simply add `makefilet` as a git submodule to your project:

```shell
git submodule add https://notabug.org/sumpfralle/makefilet.git makefilet
touch Makefile
sed -i 1i'include makefilet/main.mk' Makefile
```

From time to time you may want to update the HEAD of this submodule to the latest release.

You will need to add `git submodule update --init` to the download / clone instructions of your project.


# System-wide installation
Create a deb package of `makefilet` (simply run `make dist-deb`) and install it on the systems that you will use for working on your project.

Now add the `include makfilet/main.mk` statement to the top of your `Makefile`:

```sh
touch Makefile
sed -i 1i'include makefilet/main.mk' Makefile
```

This approach is suitable if you are working on your own or if your peers are willing and able to install build requisites on their machines.


# Embed a code copy of makefilet
The path to hell is paved with dirt: run `make install` in the `makefilet` repository and copy the resulting `root` directory into your project.

Then you should add the `include makfilet/main.mk` statement to the top of your `Makefile`:

```sh
touch Makefile
sed -i 1i'include makefilet/main.mk' Makefile
```

Of course this copy will go stale and thus cause headaches later on. Enjoy the ride!
